package org.lld.im.service.group.dao.mapper;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.lld.im.service.group.dao.ImGroupEntity;
import org.lld.im.service.group.dao.ImGroupMemberEntity;

import java.util.Collection;


@Mapper
public interface ImGroupMapper extends BaseMapper<ImGroupEntity> {

    @Select("select * from im_group where group_id=#{groupId} and app_id=#{appId}")
    ImGroupEntity selectOne1(@Param("groupId") String groupId, @Param("appId") Integer appId);
    @Select(" <script> " +
            " select max(sequence) from im_group where app_id = #{appId}" +
            "<if test='groupId != null and groupId.size() > 0'>" +
            " and group_id in " +
            "<foreach collection='groupId' index='index' item='id' separator=',' close=')' open='('>" +
            " #{id} " +
            "</foreach>" +
            "</if>" +
            " </script> ")
    Long getGroupMaxSeq(Collection<String> groupId, Integer appId);
}
